#!/usr/bin/env python

import os
import re

from os import path
from glob import iglob as glob


def main():
    exp = re.compile('(\d+)(_.+)')
    names = glob('*')
    c = 0
    for x in names:
        get = re.search(exp, x)
        if not get:
            continue
        new = get.group(1).zfill(5) + get.group(2)
        if x != new:
            os.rename(x, new)
            c += 1
    print c


if __name__ == '__main__':
    main()
